package com.hunzi.utlis;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016110200785811";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCL5l+/eQ4pr0e+CMcNxpNfI5k5adw3dUkWP0guvIVNstt9mCF2HjYPr5NIRy1FRHihKvDLxVey1nXSXuNvJjTzFc7PwjyWMlOxR1iCNh0mKZ6nxc4p1DjIftW/8mtGRIwi7rxSK1s5FDTaiWR4nqDKtHPymyJB7sHrhtQcW43Wg0zsfCHTihh4ws0MK47zE3gtBasmTylDzB/nuBzKV51VongplGAsUWmAeCYaBKwnmsgJuokynGoCBwd/OEo82lAecDdV9ux9+GhFbcu+nXCM7JK76uMoWfWcPe7ODwDahZUNhZOKORLXVbaedg5XDzKLNN0wYnExrkXIJhQYSWqvAgMBAAECggEAV+SWhx8w7LN4qUWueVMmx4EABPgjKJyBHH8JhINgZJ5YE6H+c80rPdOa/q/pGzmXZ/ooan1DSdI/F7oRvYUNgyNSWWi408wulJQ0YSpKSe2gBdvaWKFCQ4ScGgndp7ntKQ1AN4eRulydkCb9fmJ6tp+EsQkSDsZIAwckP+StSfUjXMjkTWjzoO43siV/9wW+DnFztr+u7xKR66ELR1Az055TplnzqV+mM8juShtD12BssJvNfYwsvonxROVG3jQpD2iss/IbNG2uIR9hDaMNj8TQK18+eCjy890mAerlYvozbYJ2zj3IyM4jw3k+74U9nYUu3wM1tYw3i3Uc7p6/4QKBgQDv6R1dqQfjAHZTNzmT8OeTOVQv2/oIg73Tu1SBvmt70vt6dXiaIvaLrAme/1m0870TmKz5FNNf1cAQUc73AVsFx7PICVd4TdP+P8nvFF8wvZV19S0AM7A7X8m1vZkdRNsL14mMmi/rUElIP7T36nE3kRh4BuySqAxpCysoMNYsZwKBgQCVSDvauKh6OVQk+Q/C/3Mz2d5ojK1bQJmQUO39TlQkkgvBs0cfPLp1DkXAuL6mjrPJM6IfqHAgoE3hb4zKkxuqXWP1dP6P8JGgqBT7fDIRYoTcfG8DGp5K8zLXHo5j7WkJxBrp7B10VcZ0pvh7rZBuezTaOWBzoQK2QPlT0BlieQKBgD5Wf1fn5PG6HATRc7eaQEIEAnkRGq39tWR/55xy4zDgiJGwVm8OqKtwP2u+BAw9zSJ7aG6sV6QuQWK8LyAFjSY6Vt+idcT/zBbjclAaJgXfLSfiVhgYVjGHWT1ND60ISDaSgd4z7kGhsfkA/L/yfgqnPAlsGyqcWeUtjsA5uFz/AoGAXXPZ3IPLHLC052xvnJAUS3pxjBu9DqozODAhvHiDnl07NOiJdpmq1Eq6CfrdhyFAlY1YSd9FSndwKdeOWOac5BsQz4GNNwjP8bYnZIQMR+vX5ruTN2s7ewoiYp8DXrUqE24LtzMUAVcNJMu+NJakGzXQEWjn45sBOp0UOI7GxWkCgYEA1O7/Ba2LUecjSWIXo97lY2bNP0xvTUc5uyk8cYcK3gxFW+e8zgvd6ADmijfe2WsgYU7wJbvTvnibB3QNij3VU0f1i8UEUZDv/6eliIwZyJWgdOODQjJYxnvHUshWv6C4Lbr7lfeJBnXhzayuhrkZQi8mnKrRpqSJ+SdM2sTjE4s=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvwx+sGoeQqhsjVmn220LuS+r3WbnxWYdLMRfRVmiDxIrJBt9l1Dh+LwAJJ0kqiUitu5VXw5RlK/spn4MB9JNJ01pH/eP+7NhpZKkg9T1xDGHBGBLVJUF2cL5rKcjs+bPgpNAY5KxM6GoPPPvV5EWTS0lEaYzlMjACNcWjKGiCLpuEoNsHTJTySxX5F2Upjy7AFFQD/tZnhtloBaQqLpqUgWu2mQxmcGLIvHnG2G+yKo1aXPCttgZKEbhxV5QkRva8VtgpQ9EJllhQ54t8CoOyiqFz2fSZNEzO2PLkkUnArjB85dce52xONLHytLs09iSPNyhS3VTHZVBueJmPoJAyQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "";
	//沙箱环境只能使用同步回调
	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/pay/back";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

